package su.msk.jet.team01.chatik.client.ui.swing;

import javax.swing.BoxLayout;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class ChatPanel extends JPanel {

	private final MessageBox messageBox;
	private final TextBox textBox;

	ChatPanel() {
		setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

		messageBox = new MessageBox();
		add(messageBox);

		textBox = new TextBox();
		add(textBox);
	}

	void focus() {
		textBox.requestFocusInWindow();
	}

	void printMessage(final String message) {
		messageBox.println(message);
	}

	String readMessage() {
		return textBox.readMessage();
	}
}
